package com.esinhai.tz.webservice;

import com.esinhai.tz.util.ToolUtil;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by 32988 on 2018/4/27.
 */
public class WebServiceFrontImages {
    static Logger logger = LoggerFactory.getLogger(WebServiceFrontImages.class);

    private static String str1;

    /**
     * 海景科技的远程调用webservcie接口
     *
     * @param idcard
     * @param imageBase64
     * @return
     */
    public static String hskjWebService(String idcard, String imageBase64) {
        try {
            //hskj-身份证号
            SoapObject localSoapObject = new SoapObject("http://www.fzhjkj.com/FaceServices/", "RegisterPerson");
            localSoapObject.addProperty("key", "d013cfa7-21bb-4309-ad5b-cc485754c70a");
            localSoapObject.addProperty("uniqueCode", "hjkj-" + idcard);
            localSoapObject.addProperty("appID", "cb7810f8-c8b1-443a-ae46-a6372ce9bb18");
            localSoapObject.addProperty("imageBase64", imageBase64);
            SoapSerializationEnvelope localSoapSerializationEnvelope = new SoapSerializationEnvelope(110);
            localSoapSerializationEnvelope.dotNet = false;
            localSoapSerializationEnvelope.bodyOut = localSoapObject;
            HttpTransportSE localHttpTransportSE = new HttpTransportSE(ToolUtil.reloadProperties("wsdl.path"), 10000);
            localHttpTransportSE.call("http://www.fzhjkj.com/FaceServices/RegisterPerson", localSoapSerializationEnvelope);
            Object localObject2 = localSoapSerializationEnvelope.getResponse();
            if (localObject2 != null) {
                str1 = localObject2.toString();
            }
            localHttpTransportSE.getServiceConnection().disconnect();
        } catch (Exception localException) {
            logger.error("getWebServiceVerify：", localException);
            str1 = "error:" + localException.getMessage();
        }
        return str1;
    }
    public static String hskjRemoveWebService(String idcard) {
        try {
            SoapObject localSoapObject = new SoapObject("http://www.fzhjkj.com/FaceServices/", "UnRegisterPerson");
            localSoapObject.addProperty("key","d013cfa7-21bb-4309-ad5b-cc485754c70a");
            localSoapObject.addProperty("uniqueCode", "hjkj-" + idcard);
            localSoapObject.addProperty("appID", "cb7810f8-c8b1-443a-ae46-a6372ce9bb18");
            SoapSerializationEnvelope localSoapSerializationEnvelope = new 	SoapSerializationEnvelope(110);
            localSoapSerializationEnvelope.dotNet = false;
            localSoapSerializationEnvelope.bodyOut = localSoapObject;
            HttpTransportSE localHttpTransportSE = new 	HttpTransportSE(ToolUtil.reloadProperties("wsdl.path"), 10000);
            localHttpTransportSE.call("http://www.fzhjkj.com/FaceServices/UnRegisterPerson", 	localSoapSerializationEnvelope);
            Object localObject2 = localSoapSerializationEnvelope.getResponse();
            if (localObject2 != null) {
                str1 = localObject2.toString();
            }
            localHttpTransportSE.getServiceConnection().disconnect();
        } catch (Exception localException) {
            logger.error("getWebServiceVerify：", localException);
            str1 = "error:" + localException.getMessage();
        }
        return str1;
    }

}
